# User Matches by Hero

> `GET /api/user/matches/hero/{hero_identifier}`: User endpoint of the Rone Arena API.

**Deprecated:** still answers, but will not receive further work. Prefer another endpoint.

**Sign-in required:** send `Authorization: Bearer <jwt>`. Get the JWT from `POST /api/user/auth/send-vc` then `POST /api/user/auth/login`.

Retrieve the authenticated player's recent matches filtered by a specific hero using a valid JWT. Supports query parameters for season filtering, pagination, and localization. Requires an Authorization header with the JWT from login.

Headers:
- **Authorization**: `Bearer <jwt>` (JWT obtained during login).

Path parameters:
- **hero_identifier**: Hero identifier as numeric hero ID or hero name. Accepts values like `30`, `Yi Sun-shin`, or `yisunshin`.

Query parameters:
- **sid**: Season ID for filtering matches (must be a valid season ID from `/api/user/season`).
- **limit**: Maximum number of matches to retrieve (minimum: 1).
- **last_cursor**: Cursor for pagination. Use the value from `pageInfo.nextCursor` in the current response. If `pageInfo.hasNext` is `false` or `pageInfo.nextCursor` is empty, there is no next page.
- **lang**: Language code for localized content (default: `en`).

Response structure:
- **code**: Status code (0 indicates success).
- **message**: Response message from upstream service.
- **traceID**: Upstream trace identifier for request debugging/tracking.
- **data**: Main payload object.
    - **pageInfo**: Pagination metadata object.
        - **nextCursor**: Cursor value for the next page, used for pagination.
        - **hasNext**: Boolean flag indicating whether more results are available.
        - **count**: Number of results returned in the current page.
    - **hi**: Aggregated hero summary for the selected hero and season.
        - **hid**: Hero ID.
        - **tc**: Total Count (matches played with this hero).
        - **wc**: Win Count (matches won with this hero).
        - **bs**: Battle Score (average score; interpret as `bs/100` when non-zero).
        - **mr**: Match Rating points for this hero.
        - **mrp**: Match Rating percentage/contribution.
        - **hid_e**: Hero metadata object.
            - **id**: Hero ID metadata.
            - **n**: Hero name.
            - **ix**: Hero image URL.
            - **i2x**: Large hero image URL.
        - **p**: Hero power/MMR-style value.
    - **result**: Array of match entries for this hero.
        - **sid**: Season ID.
        - **bid**: Battle ID (numeric).
        - **hid**: Hero ID used in that match.
        - **k**: Kills.
        - **d**: Deaths.
        - **a**: Assists.
        - **lid**: Lane ID (1 EXP, 2 Mid, 3 Roam, 4 Jungle, 5 Gold).
        - **s**: Match score/performance value (commonly interpreted as `s/100`).
        - **mvp**: MVP flag (1 if MVP, 0 otherwise).
        - **res**: Result (1 = Win, 0 = Loss).
        - **ts**: Match timestamp (unix time).
        - **hid_e**: Hero metadata object.
            - **id**: Hero ID metadata.
            - **n**: Hero name.
            - **ix**: Hero image URL.
            - **i2x**: Large hero image URL.
        - **bid_s**: String battle ID.

Pagination example:
    First request: `/api/user/matches/hero/17?sid=40&limit=10&lang=en`
    Next request: `/api/user/matches/hero/17?sid=40&limit=10&last_cursor=<pageInfo.nextCursor>&lang=en`
    Stop pagination when `pageInfo.hasNext = false` or `pageInfo.nextCursor` is empty.

## Request

`GET https://arena.rone.dev/api/user/matches/hero/{hero_identifier}`

### Parameters

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `hero_identifier` | path | string | yes |  | Hero identifier as numeric hero ID or hero name. Accepts values like `30`, `Yi Sun-shin`, or `yisunshin`. Name matching ignores spaces/symbols and is case-insensitive (e.g., `Luo Yi` to `luoyi`). |
| `sid` | query | integer | yes |  | The season ID for filtering matches by hero. |
| `limit` | query | integer | no | `10` | The maximum number of matches to retrieve. Range: 1... |
| `last_cursor` | query | string | no |  | Pagination cursor from `pageInfo.nextCursor` of the current response. |
| `lang` | query | string | no | `en` | Language code for localized content. One of: `en`, `id`, `ru`, `es`, `pt`, `tr`, `ar`, `de`, `fr`, `it`, `ja`, `ko`, `th`, `vi`, `zh-CN`, `zh-TW`, `km`. |

### Example

```bash
curl -X GET 'https://arena.rone.dev/api/user/matches/hero/{hero_identifier}?sid=<sid>' \
  -H 'Authorization: Bearer <jwt>'
```

## Example response

```json
{
  "code": 0,
  "message": "Success",
  "traceID": "15b79802139dd7766774f6e84ffc31bd",
  "data": {
    "pageInfo": {
      "nextCursor": "",
      "hasNext": false,
      "count": 0
    },
    "hi": {
      "hid": 17,
      "tc": 9,
      "wc": 8,
      "bs": 0,
      "mr": 6788,
      "mrp": 0.6641,
      "hid_e": {
        "id": 17,
        "n": "Fanny",
        "ix": "https://wsrv.nl/?url=https%3A%2F%2Fakmweb.youngjoygame.com%2Fweb%2Fsvnres%2Fimg%2Fmlbb%2Fcommunity%2F100_ae8ca46da01da69619a6c03dc7069921.png",
        "i2x": "https://wsrv.nl/?url=https%3A%2F%2Fakmweb.youngjoygame.com%2Fweb%2Fsvnres%2Ffile%2Fmlbb%2Fhomepage%2F100_74fabc6c0d5db065fbb836b6879f36ca.jpg"
      },
      "p": 1496
    },
    "result": [
      {
        "sid": 40,
        "bid": 4138442308503475824,
        "hid": 17,
        "k": 7,
        "d": 3,
        "a": 7,
        "lid": 4,
        "s": 810,
        "mvp": 0,
        "res": 1,
        "ts": 1774955310,
        "hid_e": {
          "id": 17,
          "n": "Fanny",
          "ix": "https://wsrv.nl/?url=https%3A%2F%2Fakmweb.youngjoygame.com%2Fweb%2Fsvnres%2Fimg%2Fmlbb%2Fcommunity%2F100_ae8ca46da01da69619a6c03dc7069921.png",
          "i2x": "https://wsrv.nl/?url=https%3A%2F%2Fakmweb.youngjoygame.com%2Fweb%2Fsvnres%2Ffile%2Fmlbb%2Fhomepage%2F100_74fabc6c0d5db065fbb836b6879f36ca.jpg"
        },
        "bid_s": "4138442308503475824"
      }
    ]
  }
}
```

## Links

- Try it in the playground: https://arena.rone.dev/web/user/matches/hero/{hero_identifier}
- User endpoints: https://arena.rone.dev/web/user.md
- OpenAPI schema: https://arena.rone.dev/api/openapi.json
